import { DeptsQuery } from '@/types/depts';
import { PaginationQuery } from '@/types/table';
import useTables from './listTables';

let { tableQuery } = useTables;
const { getTableData, selectedRowKeys, selectedRow } = useTables;

export const handleInitTable = (query: PaginationQuery | DeptsQuery) => {
    tableQuery.page = 0;
    tableQuery = Object.assign({}, tableQuery, query);
    getTableData(tableQuery);
};

export const handleResetTable = () => {
    tableQuery.page = 0;
    selectedRowKeys.value = [];
    selectedRow.value = {};
    getTableData(tableQuery);
};
